VERSION 5.00
Begin VB.Form FrmServerList 
   BorderStyle     =   3  'Fixed Dialog
   ClientHeight    =   6600
   ClientLeft      =   45
   ClientTop       =   45
   ClientWidth     =   7620
   ControlBox      =   0   'False
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6600
   ScaleWidth      =   7620
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.CheckBox ChkShow 
      Height          =   495
      Left            =   240
      TabIndex        =   5
      Top             =   4680
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.CommandButton cmdEdit 
      Height          =   495
      Left            =   1560
      TabIndex        =   3
      Top             =   5400
      Width           =   1215
   End
   Begin VB.CommandButton CMDOk 
      Cancel          =   -1  'True
      Caption         =   "Command1"
      Height          =   495
      Left            =   6120
      TabIndex        =   6
      Top             =   5400
      Width           =   1215
   End
   Begin VB.CommandButton cmdDelete 
      Caption         =   "&Delete Server"
      Height          =   495
      Left            =   3360
      TabIndex        =   4
      Top             =   5400
      Width           =   1215
   End
   Begin VB.CommandButton cmdNew 
      Height          =   495
      Left            =   240
      TabIndex        =   2
      Top             =   5400
      Width           =   1215
   End
   Begin VB.ListBox LstServers 
      Height          =   3960
      Left            =   2040
      Sorted          =   -1  'True
      TabIndex        =   0
      Top             =   840
      Width           =   3495
   End
   Begin VB.Label LblServers 
      Height          =   495
      Left            =   2040
      TabIndex        =   1
      Top             =   240
      Width           =   2655
   End
End
Attribute VB_Name = "FrmServerList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit




Private Sub cmdDelete_Click()
Dim rs As Byte

rs = MsgBox(SPrintF(lang.Messages(91), LstServers.List(LstServers.ListIndex)), vbQuestion + vbYesNo, lang.Messages(62))
If rs = vbYes Then
IM.DelSection LstServers.List(LstServers.ListIndex)
LstServers.RemoveItem (LstServers.ListIndex)
If LoadServerList(ServerListFile) <> 1 Then
AddServers
Else
cmdDelete.Enabled = False
cmdEdit.Enabled = False
End If
End If

LstServers.SetFocus

End Sub

Private Sub cmdEdit_Click()
Dim Index As Byte

Me.Hide
frmNewServer.smode = 1
frmNewServer.PrevContent = LstServers.List(LstServers.ListIndex)
Index = FindIndex(LstServers.List(LstServers.ListIndex))
If Index <> -1 Then
frmNewServer.TxtName.Text = servers(Index).sName
frmNewServer.txtHost.Text = servers(Index).address
frmNewServer.txtPort.Text = servers(Index).Port
frmNewServer.Show vbModal, FrmServerList
End If

End Sub

Private Sub cmdNew_Click()
Me.Hide
frmNewServer.Show vbModal, FrmServerList

End Sub

Private Sub cmdOK_Click()
Unload FrmServerList
frmConnectManager.Show

End Sub

Private Sub Form_activate()
LstServers.SetFocus
End Sub

Private Sub Form_Load()
Me.Caption = lang.Messages(44)
LblServers.Caption = lang.Messages(45)
cmdNew.Caption = lang.Buttons(11)
cmdDelete.Caption = lang.Buttons(12)
CMDOk.Caption = lang.Buttons(2)
cmdDelete.Enabled = False
cmdEdit.Caption = lang.Buttons(20)
cmdEdit.Enabled = False


If LoadServerList(ServerListFile) <> 1 Then
AddServers
End If



End Sub

Public Sub AddServers()
Dim i As Byte

LstServers.Clear


For i = 0 To UBound(servers)
LstServers.AddItem servers(i).sName
Next i
LstServers.ListIndex = 0
cmdEdit.Enabled = True
cmdDelete.Enabled = True

End Sub


Private Sub LstServers_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyDelete Then
cmdDelete_Click
End If

End Sub

Private Function FindIndex(ByVal ServString As String) As Integer
Dim i As Byte

If ArrayInitialised(ArrPtr(servers)) Then
For i = 0 To UBound(servers)
If servers(i).sName = ServString Then
FindIndex = i
Exit Function
End If
Next i
FindIndex = -1
Else
FindIndex = -1
End If

End Function
